﻿using AbpProjectTemplate.Localization;
using Jy.Abp.BlobStoring;
using Jy.Abp.Identity;
using JY.Abp.GeneralTree;
using Volo.Abp.Account;
using Volo.Abp.Identity.Localization;
using Volo.Abp.Localization;
using Volo.Abp.Modularity;
using Volo.Abp.ObjectExtending;
using Volo.Abp.PermissionManagement;
using Volo.Abp.SettingManagement;
using Volo.Abp.VirtualFileSystem;

namespace AbpProjectTemplate;

[DependsOn(
     typeof(AppDomainSharedModule),

    typeof(JyAbpIdentityApplicationContractsModule),
    typeof(JyAbpGeneralTreeApplicationContractsModule),
    typeof(JyAbpBlobStoringApplicationContractsModule),
    typeof(AbpAccountApplicationContractsModule),
    //typeof(AbpFeatureManagementApplicationContractsModule),
    typeof(AbpPermissionManagementApplicationContractsModule),
    typeof(AbpSettingManagementApplicationContractsModule),
    //typeof(AbpTenantManagementApplicationContractsModule),
    typeof(AbpObjectExtendingModule)
)]
public class AppApplicationContractsModule : AbpModule
{
    public override void PreConfigureServices(ServiceConfigurationContext context)
    {
        DtoExtensionsConfigurator.Configure();
    }

    public override void ConfigureServices(ServiceConfigurationContext context)
    {
        this.Configure<AbpVirtualFileSystemOptions>(options =>
        {
            options.FileSets.AddEmbedded<AppApplicationContractsModule>(this.GetType().Namespace);
        });
        this.Configure<AbpLocalizationOptions>(options =>
        {
            options.Resources
                .Get<AppResource>()
                //.AddBaseTypes(typeof(IdentityResource))
                .AddVirtualJson("/Localization/Application");

            options.Resources
                .Get<IdentityResource>()
                .AddVirtualJson("/Localization/Identity");
        });
    }
}
